package cn.xpf.study.controller;

import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Create on 2021/5/13
 *
 * @author shuxinsheng@qiyi.com
 **/
@RequestMapping("/login")
@Controller
public class LoginController {

    @RequestMapping("/index")
    public String index() {
        return "login";
    }

    @RequestMapping("/in")
    public String index(
            Model model,
            HttpSession httpSession,
            @RequestParam(value = "username") String username,
            @RequestParam(value = "password") String password) {
        httpSession.setAttribute("username", username);
        return "redirect:/index";
    }
}
